﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace 装箱和拆箱
{
    class Program
    {
        static void Main(string[] args)
        {
            int a = 1;
            object b = a;//装箱
            a = 2;
            Console.WriteLine("值类型的值为{0}",a);
            Console.WriteLine("应用类型的值为{0}", b);
           //拆箱
            int c = 3;
            Console.WriteLine("装箱前的c值{0}", c);
            object d = c;//装箱转换
            d = 4;//改变d的值
            c = (int)d;//拆箱转换，需要用强制转换
            Console.WriteLine("装箱后的c值{0}", c);
            Console.ReadLine();




                
          
           
                
        }
    }
}
